package top.mable.common.exception;

import lombok.Data;

/**
 * 业务异常
 */

@Data
public class BusinessException extends RuntimeException {

    private String code;

    /**
     * 占位符需要绑定参数数组，需按顺序
     */
    private Object bindArgs[];

    /**
     * 异常参数中的枚举对象
     */
    private Enum enums;


    public BusinessException(Enum enums, Object[] bindArgs) {
        this.enums = enums;
        this.bindArgs = bindArgs;
    }

    public BusinessException(Enum enums){
        this.enums = enums;
    }

    public BusinessException(Enum enums, Throwable throwable){
        super(throwable);
        this.enums = enums;
    }

    public BusinessException(String str, Throwable throwable){
        super(str, throwable);
    }

    public BusinessException(String str){
        super(str);
    }
}
